home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Internet E-Mail Workshop
/
Internet E-Mail Workshop.iso
/
tutorial
/
pc_learn
/
dos2.tut
< prev
next >
Wrap
Text File
|
1993-08-16
|
19KB
|
373 lines
----------------------------------------------------------------
INTERMEDIATE DOS COMMANDS
----------------------------------------------------------------
Life gets more interesting the longer you stay in the game. The
more you want to accomplish with a computer, the more you need
additional DOS commands. However, let's take a side trip to
the keyboard and study several powerful DOS shortcuts.
The keyboard function keys labelled F1 through F10 access a
special buffer storage area of DOS. Additional key combinations
offer other shortcuts. Some keyboards have twelve function keys
while others have the function keys arranged along the top of
the keyboard rather than stacked along the side.
The best way to understand how the function keys work is to
pause and explain the concept of a keyboard buffer which is
little more than a temporary storage area in the computer's
memory. A buffer is necessary because the activities of input
and output (using the keyboard or printer) are much slower than
those activities which interact with the speedy RAM memory chips
and CPU.
Data from the keyboard is placed into a memory buffer area until
you signal the PC that you are ready to move on to the next
task. Usually this signal is the carriage return or enter key. A
buffer storage area can vary in size. For the DOS command line
buffer, up to 127 characters can be contained. When data is
entered into the keyboard buffer is stays there until flushed
out. DOS allows some limited repeating and editing of data
stored in the buffer (data you previously typed at the keyboard)
by use of the function keys.
The FUNCTION Keyboard:
The following discussion applies to the function keys WHEN
YOU ARE USING DOS! When you use an application such as your word
processor or database program the function keys will probably
have different uses!
The function keys assume different roles for different programs.
F1 through F5 have special meaning within DOS. They help in
reissuing/editing the last DOS command typed.
F1 Repeats one character per keystroke of the previous DOS command
typed.
F2 Repeats characters stored in the buffer up to the character
you typed after pressing F2.
F3 Repeats the entire LAST command. USEFUL! Repeat last command
and edit it over again with other function keys or the backspace
key.
F4 Deletes all characters in the buffer up to the character you
typed after F4. The buffer is not displayed. To see the buffer
on screen tap F3.
F5 Stores the current line for re-editing. F5 is used with the
other four keys so you can repair long DOS commands which
weren't typed in properly. When you press F5 the current line
will be marked and the cursor will move down one line WITHOUT a
new prompt. Then use the other function keys to finish editing.
The main Keyboard
Delete key deletes character on or to the right of the cursor
Backspace key removes last character typed - to the left of
cursor
Insert key puts keyboard into insert mode
Escape key voids current input and exits or escapes to previous
settings
PageUp key in many applications moves you up one screen of text
PageDown key in many applications moves you down one screen of
text
Left and right arrow keys move cursor left and right without
deleting
Numlock key toggles (goes back and forth) between numbers on the
numeric keypad and cursor control (functions such as page down,
move cursor right, etc)
Pressing two or more keys at the same time produces further
results. You may hold down the Control (Ctrl) key and then
press another key for a required result. Here are some two key
combinations. Hold down the first key, then press the second:
Shift-PrtSc prints one screen of data on your printer.
Control-C or Control Break Aborts current DOS command. USEFUL!
Control-H or backspace removes last character typed
Control-P or Control-PrtSc sends output to printer until turned
off by typing same key combination (Control P) a second time.
Whatever appears on screen will be sent to printer until turned
off with control P a second time. This is a little used, often
forgetten and HIGHLY useful key combination!
Control Numlock or Control S pauses screen output. Press any key
to continue
Control-Alt-Delete keys together shuts down computer and WIPES
OUT all computer data! This is also called a "warm boot"
as compared to a cold boot (completely turning off computer,
then turning back on again.) Either of these methods means that
ALL DATA AND PROGRAMS LOST from RAM memory but whatever data
stored on disk(s) remains.
Other keys have special meanings and can be confused with their
look-alike twins: the slash (/) and Backslash (\) are different
but easily confused as are the apostrophe (') and grave accent (`),
and also the capital O and Zero (0.)
----------------------------------------------------------------
ADDITIONAL DOS COMMANDS AND METHODS
----------------------------------------------------------------
Now on to some of the more advanced DOS commands, files and
methods which we continue from the previous DOS tutorial:
-- AUTOEXEC.BAT -- is not a DOS command but a small text file
which gives the user an automatic way to specify a precise
series of DOS commands whenever the computer is started each
day. Within AUTOEXEC.BAT you can specify system variables such
as the PATH and PROMPT commands, load or start a menu system
with a variety of program choices, load memory resident "TSR"
programs such as a calculator or notepad, run other batch files
or start one specific program such as your word processor every
time the computer is turned on. You can create or modify an
AUTOEXEC.BAT file with any word processor which saves text in
ASCII (plain text) format. Additional comments and explanations
about the AUTOEXEC.BAT file are provided in the batch file
tutorial elsewhere within PC-Learn. Following is a listing of
the contents within a sample AUTOEXEC.BAT file. Note that it is
simply a series of DOS commands which will be given every time
the computer is first turned on. This list of autoexec.bat
comamnds are only a sample, there are other variations which
might be more appropriate for your computer.
echo off
date
time
path \dos;\wp;\util;\doc;\bat
prompt $P$G
verify on
mode bw80,r
type menu
-- CONFIG.SYS -- is not a DOS command, but a small text file
which tells DOS the system setup information or "custom
configuration" of your computer. Whenever additional hardware is
added such as a tape drive, mouse, ram drive or other device,
you will usually add a DEVICE command to the CONFIG.SYS file so
that DOS can recognize the new hardware or software device.
Performance can also be increased by adding other parameters to
the CONFIG.SYS file such as the FILES and BUFFERS commands. On
startup, CONFIG.SYS helps DOS determine the configuration of
hardware, RAM memory, keyboard, ramdisk, hard drives and other
"customizations" to your system and is usually stored in the
root or main directory of your hard drive. The CONFIG.SYS file
can be prepared or altered with your word processor operating in
ASCII mode (plain text). You could also use the COPY CON command
or any text editor such as Edlin to prepare a CONFIG.SYS file.
Following is a listing of the contents within a sample CONFIG.SYS
file:
device=ansi.sys
device=vdisk.sys
buffers=20
files=20
-- MODE -- (External) is a command to setup the printer,
display and communications outputs of your computer. Use mode
when you have several printers or two or more monitors such as
both color and monochrome.
Example: A>mode CO80 (set display mode to color,80
columns wide)
Example: B>mode lpt1=com1 (set printer to com port number
1)
Example: A>mode com1:10,n,8,1,p (set modem transmission
settings)
Example B>mode bw80,r (set monitor to b&w text, 80
columns wide)
-- MORE -- (External) causes the display to pause when reading a
long file or directory. More is always combined with other DOS
commands. See below for an example using the MORE command.
-- REDIRECTION AND PIPING -- Are not DOS commands but powerful
methods for sending information to or through other DOS
utilities.
Some commands, for example DIR, can use MORE, SORT and other DOS
"filters" with a special vertical bar | in a method called
"piping". Piping is best explained as "filtering" a DOS action
through yet another DOS program or command.
Example A>dir|more (DIR listing is "piped" through
MORE to pause after each
screenful of information)
Try it with a long listing!
Example: B>type letter.txt|more (the file letter.txt is "piped"
through MORE)
-- < and > -- are input/output symbols. They help DOS send and
receive signals properly. You can redirect the output from or
towards a particular device. For example if the output of a file
normally goes to the screen you could redirect it with the >
symbol to the printer. Or you could redirect the input for a DOS
command from a file, rather than the keyboard so you would not
have to answer a series of questions - the file would provide
the keystrokes.
Example: A>sort<letter.txt>letter.new (sort letter.txt and
output to a new file
called letter.new)
Example: B>dir>prn (meaning produce a directory listing, but
send the output to the printer, rather than the screen)
Example: format b:<special.txt (format a floppy and accept input
keystrokes from the file special.txt rather than input from the
keyboard so you don't have to answer yes/no or pause)
These piping and redirection methods are powerful and subtle.
-- SORT -- (External) sorts data lists in alphabetical or
reverse order. It is frequently used with redirection and piping
methods to sort directories, lists of text or to output its
actions into a new file or directly to the printer.
Example: A>dir|sort Example: sort<letter.doc>new.doc
-- GRAPHICS -- (External) allows you to print the contents of a
graphics display (e.g., a lotus graph on the screen) while using
the SHIFT-PRTSC key combination mentioned earlier. Graphics mode
software uses medium resolution CGA color displays or other
graphics displays which will not print using the standard SHIFT-
PRTSC key until the DOS graphics system has been loaded.
Graphics is a memory resident program which uses some RAM
memory. If a screen display will not print on your printer by
tapping SHIFT-PRTSC, trying running graphics first then retry
SHIFT-PRTSC.
Example: A>graphics
-- FIND -- (External) searches for words and phrases in a file.
You cannot use wild cards (? and *). You must use quotes
surrounding the phrase or word which is sought.
Example: A>find "chocolate candy bars" letter.txt bones.wks
(meaning: search for "chocolate candy bars" within the two
files letter.txt and bones.wks then report any occurrences)
-- ASSIGN -- (External) tells DOS to send disk requests for one
drive to the other. Effectively renames your a drive the b drive
and vice versa. Allows you to access only certain drives for
security reasons (remote modem use, for example). By itself,
assign simply restores the normal drive configurations and
names. DISKCOPY and FORMAT commands ignore assign! Use of assign
command is rare.
Example: B>assign c=a
-- PATH -- (Internal) tells DOS where to search for executable
files in the subdirectories you specify. Allows simultaneous
searching of many subdirectories at once. Path eliminates the
need to search through many subdirectories manually. Frequently
a PATH command is used in your autoexec.bat file when starting
the computer. A path command is highly recommended for use with
all hard drives and, as stated, is embedded within the
AUTOEXEC.BAT file as a permanent command.
Example: C>path \letters;\finance;\utils
-- PROMPT -- (Internal) allows change of the DOS prompt - for
example, the dull A> on screen. $P shows the active directory.
$G shows the > symbol. This can be set in the main autoexec.bat
file to initialize the prompt every time you start your
computer. With the proper commands you can dramatically change
your prompt to even display words, pictures or phrases rather
than a typical C>
See batch file tutorial covered later.
Example: A>prompt $P$G. (result is: a:\> )
-- TREE -- (External) shows the structure of the subdirectories
on your disk. You can check the arrangement of the root (main)
and all subdirectories. Tree/f shows all file names.
Example: B>tree/f
-- ATTRIB -- (External) allows a file to be set as "read only"
(non-erasable). Attrib +r marks for read only. Attrib -r removes
this. Protects files from modification or removal. Attrib alone
displays file attributes. A small r appears to the left of a
files directory listing if that file is read only (protected).
Only available in DOS 3.0 and later.
Example: A>attrib +r letters.doc
-- BACKUP & RESTORE -- (External) used to making spare copies
(backups) of hard disk data. Copies groups of files to floppies.
Restore reverses the process and puts the files from floppies to
hard disk. Backup/m copies only files modified since the last
backup. Backup/s copies all subdirectories and their files.
Backup/d copies files modified after the date you specify.
Backup/a adds files to a disk that already contains other files.
Files copied to floppies with backup can't be used (they are
"encoded") until they are restored ("unencoded"). Restore/s puts
back all subdirectory files.
Example: A>backup c:\*.* a:/s
Example: C>restore a:\*.* c:/s
-- EDLIN -- (External) is a small word processor/text editor
which prepares text files. DOS version 5.0 uses an upgraded
text editor called EDIT which is easier to use the Edlin.
Edlin's output is ASCII (plain text). Edlin is rudimentary and
provides editing line by line. Other word processors and text
editors can output ASCII files more quickly and easily, but
Edlin is good for short jobs such as preparing batch files. The
COPY CON command (discussed earlier) will do the job also. The
entire list of Edlin commands is detailed in your DOS manual.
Example: A>edlin go.bat (starts Edlin and loads the file go.bat)
-- RAMDRIVE.SYS -- (used in MS-DOS, see below) (External)
-- VDISK.SYS -- (used in PC-DOS, see below) (External)
Both of the above files are equivalent "ramdisks" which allow you
to construct an artificial software disk drive in RAM computer
memory. It is very fast and is also known as a virtual disk.
RAMDRIVE.SYS or VDISK.SYS is usually placed in the CONFIG.SYS
file via the DEVICE command. RAMDRIVE.SYS or VDISK.SYS is
available in DOS 3.0 and later. DOS 2.0 users can use
alternative "add in" RAMDISK utilities to produce the same
result. Within the CONFIG.SYS file the following statement might
appear for users of this device:
Example: device=vdisk.sys 128 (sets up a ramdisk of 128,000
bytes in size)
Tutorial finished. Have you registered PC-Learn to receive your
bonus disks? Registration is encouraged. Shareware works on the
honor system! Send $25 to Seattle Scientific Photography,
Department PCL6, PO Box 1506, Mercer Island, WA 98040. Latest
version of PC-Learn and two bonus disks shipped promptly!